package com.nacos.controller;


import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

@RestController
public class ProducerController {

//    @NacosInjected
//    private NamingService namingService;

    @GetMapping("/produce")
    public String getUserInfo() {
        return "nacos 调用: producer ";
    }


    @GetMapping("/produce/{name}")
    public String echo(@PathVariable("name") String name) {
        return "Hello Nacos Discovery " + name;
    }


    //http://localhost:8081/get?serviceName=produce-service
//    @RequestMapping(value = "/get", method = GET)
//    @ResponseBody
//    public List<Instance> get(@RequestParam String serviceName) throws NacosException {
//        return namingService.getAllInstances(serviceName);
//    }
}
